package com.sc.nft.dao;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.vo.DaoTransferDetailVO;
import com.sc.nft.enums.ApprovalStatusEnum;
import com.sc.nft.enums.WalletChannelEnum;
import com.sc.nft.enums.wallet.DaoTransferTypeEnum;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.DaoTransfer;
import com.sc.nft.mapper.DaoTransferMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 企业转账表(sc_dao_transfer)数据DAO
 *
 * @author zxy
 * @since 2023-12-21 15:18:22
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@Repository
public class DaoTransferDao extends ServiceImpl<DaoTransferMapper, DaoTransfer> {

    public Page<DaoTransferDetailVO> getRecords(Long daoId,Integer scence, DaoTransferTypeEnum type, String applyTel, String marketAccount, WalletChannelEnum walletChannel, ApprovalStatusEnum status, Date startTime, Date endTime, Page page) {
        return baseMapper.getRecords(page,daoId,scence,type!=null?type.getCode():null,applyTel,marketAccount,walletChannel!=null?walletChannel.getCode():null,status!=null?status.getCode():null,startTime!=null? DateUtil.beginOfDay(startTime):null,endTime!=null?DateUtil.endOfDay(endTime):null);
    }


    public String getSumSuccessAmount(Date startTime,Date endTime){
        return baseMapper.getSumSuccessAmount(startTime, endTime);
    }
}